﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SQLServer.DBUtility;

namespace SQLServer.DAL
{
    /// <summary>
    /// 工程机械，高空平平台
    /// </summary>
    public partial class Machine
    {
        public Machine()
        {

        }

        /// <summary>
        /// 根据条件查询工程机械列表
        /// </summary>
        /// <param name="strWhere">筛选条件</param>
        /// <param name="pageIndex">页数</param>
        /// <param name="pageSize">每页显示多少条数据</param>
        /// <param name="order">排序字段</param>
        /// <param name="order">排序字段</param>
        public DataTable IEProjectList(string strWhere, int pageIndex, int pageSize, string order)
        {
            string ProStr = string.Format(@"select top {0} *
               from  View_DeviceDetail 
             
               where   {1} 
               and id not in (select top  " + (pageIndex - 1) * pageSize + @" id from View_DeviceDetail where {1} order by {2} ) order by {2}
               ", pageSize, strWhere, order);
            return  DbLocalSQL.Query(ProStr).Tables[0];
        }

        /// <summary>
        /// 根据条件查询高空平台列表
        /// </summary>
        /// <param name="strWhere">筛选条件</param>
        /// <param name="pageIndex">页数</param>
        /// <param name="pageSize">每页显示多少条数据</param>
        /// <param name="order">排序字段</param>
        /// <param name="order">排序字段</param>
        public DataTable IEHighList(string strWhere, int pageIndex, int pageSize, string order)
        {

            string ProStr = string.Format(@"select top {0} *
               from  View_DeviceDetail 
               where {1}  and id not in (select top  " + (pageIndex - 1) * pageSize + @" id from View_DeviceDetail where {1} order by {2} ) order by {2}  ", pageSize, strWhere, order);
            return DbLocalSQL.Query(ProStr).Tables[0];
        }
    }
}
